// Copyright 2009 Vladimir Solomenchuk
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package net.aramzamzam.tapestry.judo.services;

import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.dom.Element;

public interface WidgetService {
	/**
	 * load dojo module
	 * @param module
	 * 	module name, for example: dijit.layout.ContentPane
	 */
	public abstract void require(String module);
	
	/**
	 * load layer
	 * @param layer
	 * 	layer name in dojo semantic ex., dijit.all
	 */
	public abstract void requireLayer(String layer);

	/**
	 * javascript code for execution after dom will be loaded (like dojo.addOnLoad(...)) 
	 * @param format
	 * 	{@link String.format}
	 * @param arguments
	 * 	{@link String.format}
	 */
	public abstract void addOnLoad(String format, Object... arguments);

	/**
	 * load css from specific name space
	 * @param nameSpace
	 * 	namespace, for example dojox.grid
	 * @param path
	 * 	path to css in namespace, for example resources/tundra.css
	 */
	public abstract void requireCss(String nameSpace, String path);
	
	/**
	 * creates dojo widget 
	 * @param dojoType
	 * 	widget class (example, dojo.form.Button)
	 * @param dojoModule
	 *  dojo module (example, dijit.Button). May be null, if component in same module
	 * @param element
	 * 	node
	 * @param widgetParameters
	 * 	widhet parameters, for exampe, "а",12
	 */
	public void createWidget(String dojoType, String dojoModule, Element element, ComponentResources resources, Object... widgetParameters);
	
	   /**
     * creates dojo widget 
     * @param dojoType
     *  widget class (example, dojo.form.Button)
     * @param element
     *  node
     * @param widgetParameters
     *  widhet parameters, for exampe, "а",12
     */
    public void createWidget(String dojoType, Element element, ComponentResources resources, Object... widgetParameters);

}